package com.lefevre.cms.bean.platformShare;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.*;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

/**
 * 解锁话题平台分成
 *
 * @author Lefevre
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName("topic_unlock_platform_share")
@Entity
@Table(name = "topic_unlock_platform_share", indexes = {@Index(name = "topic_unlock_platform_share_1_idx", columnList = "unlockTime")})
public class TopicUnhidePlatformShare implements Serializable {
    private static final long serialVersionUID = -2776115664125447453L;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @TableId(type = IdType.INPUT)
    private Long id;

    /**
     * 话题Id
     **/
    @TableField("topicId")
    private Long topicId;

    /**
     * 话题标题
     **/
    @Transient
    @TableField(exist = false)
    private String topicTitle;

    /**
     * 分成用户是否为员工
     **/
    @TableField("staff")
    private boolean staff;

    /**
     * 发布话题的用户名称
     **/
    @Column(length = 80)
    @TableField("postUserName")
    private String postUserName;

    /**
     * 发布话题的用户呢称
     **/
    @Transient
    @TableField(exist = false)
    private String postNickname;

    /**
     * 发布话题的用户头像路径
     **/
    @Transient
    @TableField(exist = false)
    private String postAvatarPath;

    /**
     * 发布话题的用户头像名称
     **/
    @Transient
    @TableField(exist = false)
    private String postAvatarName;

    /**
     * 解锁话题的用户名称
     **/
    @Column(length = 30)
    @TableField("unlockUserName")
    private String unlockUserName;

    /**
     * 解锁话题的用户呢称
     **/
    @Transient
    @TableField(exist = false)
    private String unlockNickname;

    /**
     * 解锁话题的用户头像路径
     **/
    @Transient
    @TableField(exist = false)
    private String unlockAvatarPath;

    /**
     * 解锁话题的用户头像名称
     **/
    @Transient
    @TableField(exist = false)
    private String unlockAvatarName;

    /**
     * 平台分成比例
     **/
    @TableField("platformShareProportion")
    private Integer platformShareProportion;

    /**
     * 发布话题的用户分成流水号
     **/
    @Column(length = 32)
    @TableField("postUserShareRunningNumber")
    private String postUserShareRunningNumber;

    /**
     * 总金额  精度为12位，小数点位数为2位
     **/
    @Column(nullable = false, precision = 12, scale = 2)
    @TableField(value = "totalAmount", numericScale = "2")
    private BigDecimal totalAmount = new BigDecimal("0");

    /**
     * 平台分成金额  精度为14位，小数点位数为4位 如果用户为员工，则分成全部归平台
     **/
    @Column(nullable = false, precision = 14, scale = 4)
    @TableField(value = "shareAmount", numericScale = "2")
    private BigDecimal shareAmount = new BigDecimal("0");

    /**
     * 解锁时间
     **/
    @Temporal(TemporalType.TIMESTAMP)
    @TableField("unlockTime")
    private Date unlockTime = new Date();

}
